package com.liruo.learn.spring.mvc.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author:liruo
 * @Date:2023-02-12-21:34:20
 * @Desc
 */
@RestController
@RequestMapping("/demo")
@Slf4j
public class DemoController {

    @GetMapping("/session")
    public String session(HttpServletRequest request, HttpServletResponse response){
        return "Request="+request.getClass().getName() + ",Session="+request.getSession().getClass().getName() + ",Response="+response.getClass().getName();
    }

    @RequestMapping(value = "/handler/RequestMapping", method = RequestMethod.GET)
    public void handlerRequestMapping(){
        log.info("handlerRequestMapping");
    }
    @GetMapping("/error/a")
    public void errorA(){
        throw new RuntimeException("a err");
    }
}
